import fetch from "common/src/utils/fetch";


/**
 *  导出跨校区学生
 */
function exportCrossCampusStudent(calendarId) {
  return fetch({
    url:
      "/api/electionservice/undergraduateExamReexamArrange/exportCrossCampusStudent?calendarId=" +
      calendarId,
    method: "get"
  });
}

/**
 *  手动排考校验课程组是否有相同学生或者多个教学班有相同学生，否则提示不能安排同一个时间
 */
function manualSchoolExamCheek(data) {
  return fetch({
    url: "/api/electionservice/undergraduateExamReexamArrange/manualSchoolExamCheek",
    method: "post",
    data
  });
}

/**
 *  学校排考管理手动排考保存时间
 */
function manualSchoolSaveTime(data) {
  return fetch({
    url: "/api/electionservice/undergraduateExamReexamArrange/manualSchoolSaveTime",
    method: "post",
    data
  });
}

/**
 *  学校排考删除排考
 */
function deleteReExam(data) {
  return fetch({
    url: "/api/electionservice/undergraduateExamReexamArrange/deleteReExam",
    method: "post",
    data
  });
}

/**
 *  删除考场
 */
function deleteReExamRoom(data) {
  return fetch({
    url: "/api/electionservice/undergraduateExamReexamArrange/deleteReExamRoom",
    method: "post",
    data
  });
}

/**
 *  获取排考人数
 */
function findElcNumber(data,applyNum) {
  return fetch({
    url: "/api/electionservice/undergraduateExamReexamArrange/findElcNumber?applyNum="+applyNum,
    method: "post",
    data
  });
}

/**
 *  自动排考（学校）
 */
function autoReSchoolExam(calendarId) {
  return fetch({
    url: "/api/electionservice/undergraduateExamReexamArrange/autoSchoolExam?calendarId="
      + calendarId,
    method: "post"
  });
}

/**
 *  学校学院重考排考分页查询
 */
function getListPage(data) {
  return fetch({
    url: "/api/electionservice/undergraduateExamReexamArrange/getListPage",
    method: "post",
    data
  });
}

/**
 *  添加学生列表
 */
function getUnArrangeStudent(data) {
  return fetch({
    url: "/api/electionservice/undergraduateExamReexamArrange/getUnArrangeStudent",
    method: "post",
    data
  });
}

/**
 *  学校学院重考排考分页查询
 */
const pageUrl = "/api/electionservice/undergraduateExamReexamArrange/getListPage";

/**
 *  添加学生列表
 */
const studentPageUrl = "/api/electionservice/undergraduateExamReexamArrange/getUnArrangeStudent";


/**
 *  添加学生
 */
function saveStudent(data) {
  return fetch({
    url: "/api/electionservice/undergraduateExamReexamArrange/saveStudent",
    method: "post",
    data
  });
}

/**
 * 获取 key
 */
function getResultByKey(key) {
  return fetch({
    url: "/api/electionservice/examinationMethod/result/" + key,
    method: "get"
  });
}

/**
 *  通过额定人数 获取周次 节次信息
 */
function getTimeInfo(calendarId,examType) {
  return fetch({
    url:
      "/api/electionservice/undergraduateExamNumberTime/getTimeInfo?calendarId=" +
      calendarId + "&examType="+ examType,
    method: "get"
  });
}

/**
 *  学校排考管理手动排考保存考场
 */
function manualSchoolSaveRoom(data) {
  return fetch({
    url: "/api/electionservice/undergraduateExamReexamArrange/manualSchoolSaveRoom",
    method: "post",
    data
  });
}

/**
 *  添加备注（学校备注）
 */
function addRemark(data) {
  return fetch({
    url: "/api/electionservice/schoolExamArrange/addRemark",
    method: "post",
    data
  });
}

/**
 * 获取 key
 */
function getAutoExamKey(key) {
  return fetch({
    url:
      "/api/electionservice/undergraduateExamReexamArrange/findAutoSchoolExamStatus?key=" +
      key,
    method: "get"
  });
}

/**
 * 学校、学院排考分页查询（导出）
 */
function exportExcel(data) {
  return fetch({
    url: "/api/electionservice/undergraduateExamReexamArrange/export",
    method: "post",
    data
  });
}

/**
 * 学校、学院排考分页查询（勾选导出）
 */
function exportSelected(data) {
  return fetch({
    url: "/api/electionservice/undergraduateExamReexamArrange/exportSelected",
    method: "post",
    data
  });
}


const weeks = [
  { label: "星期一", value: 1 },
  { label: "星期二", value: 2 },
  { label: "星期三", value: 3 },
  { label: "星期四", value: 4 },
  { label: "星期五", value: 5 },
  { label: "星期六", value: 6 },
  { label: "星期日", value: 7 }
];

export default {
  weeks: weeks,
  exportCrossCampusStudent: exportCrossCampusStudent,
  manualSchoolExamCheek: manualSchoolExamCheek,
  manualSchoolSaveTime: manualSchoolSaveTime,
  deleteReExam: deleteReExam,
  autoReSchoolExam: autoReSchoolExam,
  pageUrl: pageUrl,
  getListPage : getListPage,
  studentPageUrl : studentPageUrl,
  getUnArrangeStudent : getUnArrangeStudent,
  getResultByKey: getResultByKey,
  getTimeInfo: getTimeInfo,
  manualSchoolSaveRoom: manualSchoolSaveRoom,
  getAutoExamKey: getAutoExamKey,
  findElcNumber: findElcNumber,
  deleteReExamRoom: deleteReExamRoom,
  addRemark : addRemark,
  exportExcel : exportExcel,
  exportSelected : exportSelected,
  saveStudent : saveStudent
};
